package d2_collection_traverse;

import java.util.ArrayList;
import java.util.Collection;

/**
 * 2024/6/4 Collection集合的遍历方式：使用for循环遍历集合  Cjj
 */
public class CollectionDemo2 {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        c.add("葡萄");
        c.add("橘子");
        c.add("香蕉");
        //使用增强for遍历集合或者数组
        for (String s : c) {
            System.out.println(s);

        }

        String[] names={"撒旦","爱德华","大师姐"};
        for (String name : names) {
            System.out.println(name);

        }

        int [] number={1,2,3};
        for (int i : number) {
            System.out.println(i);
        }
    }
}
